<?php

use think\migration\Migrator;
use think\migration\db\Column;

class GatherFile extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('gather_file', ['comment' => '采集文件']);
        $table->addColumn('user_id', 'integer',array('limit' => 30, 'default' => 0,'comment' => '采集用户id'))
            ->addColumn('url', 'string',array('limit' => 1500,'null'=>true,'comment' => '采集照片路径'))
            ->addColumn('project_id', 'integer',array('limit' => 11,'default' => 0,'comment' => '项目id'))
            ->addColumn('project_sample_id', 'integer',array('limit' => 11,'default' => 0,'comment' => '项目样本点id'))
            ->addColumn('project_type_id', 'integer',array('limit' => 11,'default' => 0,'comment' => '项目一级指标id'))
            ->addColumn('project_second_level_id', 'integer',array('limit' => 11,'default' => 0, 'comment' => '项目二级指标id'))
            ->addColumn('project_detail_id', 'integer',array('limit' => 11,'default' => 0, 'comment' => '项目细则指标id'))
            ->addColumn('longitude', 'string',array('limit' => 50,'null'=>true, 'comment' => '经度'))
            ->addColumn('latitude', 'string',array('limit' => 50,'null'=>true, 'comment' => '纬度'))
            ->addColumn('desc', 'string',array('limit' => 255,'null'=>true, 'comment' => '描述/备注'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
